package com.wthink.newMain.schedlePlan

import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import com.wthink.hzgj.R
import com.wthink.hzgj.databinding.FragmentSchedlePlanBinding
import com.wthink.hzgj.util.adapter.BaseViewHolder
import com.wthink.newMain.main.MainNewActivity
import com.wthink.newMain.schedlePlan.adapter.SchedlePlanAdapter
import com.wthink.newMain.schedlePlan.viewmodel.SchedlePlanViewmodel

class SchedlePlanFragment : Fragment(){

    private val viewModel by viewModels<SchedlePlanViewmodel>()

    private lateinit var binding: FragmentSchedlePlanBinding

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = DataBindingUtil.inflate(
            inflater,
            R.layout.fragment_schedle_plan,
            container,
            false
        )
        binding.viewModel = viewModel
        binding.lifecycleOwner = this
        return binding.root
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)

        binding.schedleRecycle.layoutManager = LinearLayoutManager(context,
            LinearLayoutManager.VERTICAL,false)

        binding.schedleRecycle.adapter = object : SchedlePlanAdapter(){
            override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
                super.onBindViewHolder(holder, position)
            }
        }
        viewModel.reqLine()
    }
}